revert between 56095 -> 55830 in arch
[AROS.git] / workbench / devs / AHI / Examples / Low-level / 3rd party / DetectPaulaAudio / DetectPaulaAudio.c
blob19c4e7ce2e073734bc0b7c4dbd40ce14898081db
1 /*
2 * $VER: DetectPaulaAudio.c 1.0 (14.12.01) ® 2001 by Przemyslaw 'SENSEI' Gruchala <sensei@box43.gnet.pl>
3 */
5 #include <string.h>
7 #include <devices/ahi.h>
8 #include <dos/dos.h>
9 #include <exec/devices.h>
10 #include <exec/libraries.h>
11 #include <exec/types.h>
12 #include <utility/tagitem.h>
14 #include <proto/ahi.h>
15 #include <proto/dos.h>
16 #include <proto/exec.h>
18 UBYTE VersionID[] = "$VER: DetectPaulaAudio.exe 1.0 (14.12.01) ® 2001 by Przemyslaw \'SENSEI\' Gruchala <sensei@box43.gnet.pl>";
20 int main( void )
22 int result = RETURN_FAIL;
23 struct MsgPort *ahireplyport;
24 if( ahireplyport = CreateMsgPort() )
26 struct AHIRequest *ahirequest;
27 if( ahirequest = CreateIORequest( ahireplyport, sizeof( *ahirequest ) ) )
29 ahirequest->ahir_Version = 4;
30 if( !OpenDevice( AHINAME, AHI_NO_UNIT, (struct IORequest *) ahirequest, 0 ) )
32 struct Library *AHIBase = &ahirequest->ahir_Std.io_Device->dd_Library;
33 UBYTE drivername[ 256 ];
34 if( AHI_GetAudioAttrs( AHI_DEFAULT_ID, NULL,
35 AHIDB_Driver, drivername,
36 AHIDB_BufferLen, sizeof( drivername ),
37 TAG_DONE ) )
39 Printf( "Driver name \"%s\".\n", drivername );
40 if( !stricmp( drivername, "paula" ) )
42 Printf( "Paula detected!\n" );
43 result = RETURN_OK;
45 else
47 Printf( "Paula is not detected!\n" );
48 result = RETURN_WARN;
51 else
52 Printf( "Could not get AHI driver name!\n" );
53 CloseDevice( (struct IORequest *) ahirequest );
55 else
56 Printf( "Could not open \"%s\" V%ld!\n", AHINAME, ahirequest->ahir_Version );
57 DeleteIORequest( (struct IORequest *) ahirequest );
59 else
60 Printf( "Could not create AHI request!\n" );
61 DeleteMsgPort( ahireplyport );
63 else
64 Printf( "Could not create AHI reply port!\n" );
65 return( result );